﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<form id="form1" runat="server">
<div class="path">
        <strong>用户管理</strong>
    </div>
    <div class="pd10">
        <div class="mb10 aL">
            <a href="javascript:void(showAdd())" title="添加用户" class="a-btn1" >添加用户</a>
        </div>
          <span id="Grid">
<table class="tb-list hover">
    <tr>
        <th>
            编号
        </th>
        <th>
            登录名
        </th>
        <th>
            姓名
        </th>
        <th>
            邮箱
        </th>
        <th>
            电话
        </th>
        <th>
            最后登录
        </th>
        <th>
            创建时间
        </th>
        <th width="20%">
            操作
        </th>
    </tr>
    <%  IList<AdminUserModel> AdminUserList = ViewData["AdminUserList"] as List<AdminUserModel>; %>
    <%foreach (var item in AdminUserList) %> 
    <%{ %>
     <tr>
     <td style="wid1th:10%">
           <%=item.UserID %>
        </td>
        <td style="wid1th:20%">
           <%=item.UserName %>
        </td>
         <td style="width:20%">
           <%=item.TrueName %>
        </td> 
        <td style="width:15%">
           <%=item.EMail %>
        </td>
        <td style="width:10%">
           <%=item.Telephone %>
        </td>
        <td style="width:10%">
           <%=item.LastLoginTime %>
        </td>           
        <td style="width:10%">
           <%=item.CreateTime %>
        </td>
        <td>
          <a href="/AdminUser/edit?userID=<%=item.UserID %>">编辑</a> <a href="Edit?userID=<%=item.UserID %>">职位</a>  <a href="javascript:void(showRights('<%=item.UserID %>'))">功能权限</a>  <a href="Edit?userID=<%=item.UserID %>">启用</a> <a href="javascript:;" onclick="DeleteNews('<%=item.UserID %>')">删除</a>
        </td>
    </tr>
    <%} %>
</table>
        </span>
            <!-- 分页插件  -->
        <div id="pager" class="aR mt10">
        </div>

    </div>
    </form>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadStyles" runat="server">  
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="HeadScripts" runat="server">
        <script type="text/javascript" src="/Scripts/m-lhgdialog/m-lhgdialog.js"></script>    
	<script type="text/javascript" src="/Scripts/library/m-pagination.js"></script>    

</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="BodyScripts" runat="server">
    <script type="text/javascript">

        // 删除类目
        function DeleteNews(newsID) {
            if (confirm("确认删除吗?") == false) {
                return;
            }

            $.ajax({
                url: "/News/Delete",
                data: { "newsId": newsID },
                type: "POST",
                success: function (data, textStatus) {
                    if (data.status === "warning" || data.status === "error") {
                        alert(data.msg);
                        return false;
                    }
                    // 刷新列表
                    refresh();
                },
                error: function (XmlHttpRequest, textStatus, errorThrown) {
                    alert(errorThrown);
                }
            });
        };

        // 显示编辑
        function showEdit(userID) {
            OpenPop('/AdminUser/edit?userID=' + userID, "编辑用户", 500, 480);
        };

        // 显示编辑
        function showRights(userID) {
            OpenPop('/AdminUserRight/Index?userID=' + userID, "编辑权限", 800, 650);
        };

        function showAdd() {
            OpenPop('/AdminUser/Add', "添加用户", 500, 480);
        };

        //打开弹窗
        function OpenPop(url, titleName, width, height) {
            width = width || 800;
            height = height || 500;
            window.top.winObj = window;
            window.top.oDG = new $.dialog({ id: 'esDialog', title: titleName, page: url, width: width, height: height, btnBar: false, lockScroll: true });
            window.top.oDG.ShowDialog();
        }
        
</script> 
</asp:Content>
